package com.zzyk.microCloud.controller;


import com.zzyk.main.model.pojo.SysPermission;
import com.zzyk.main.model.vo.Message;
import com.zzyk.main.service.ISysPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sys/permission")
public class SysPermissionController {
    @Autowired
    private ISysPermissionService sysPermissionService;

    // 列出所有的权限 非树状图
    @RequestMapping("list")
    public Message listPermission(SysPermission sysPermission) {
        Message message = Message.success();
        message.addData("data", sysPermissionService.getPermissionList(sysPermission));
        return message;
    }

    // 按从属关系列出权限 树状图
    @RequestMapping("tree")
    public Message permissionTree() {
        return Message.success().addData("data", sysPermissionService.getPermissionTree());
    }
}
